package com.jd.platform.sample4.service.redis;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jd.platform.sample4.entity.pojo.Produce;
import com.jd.platform.sample4.mapper.ProduceMapper;
import com.jd.platform.sample4.util.RedisService;
import org.springframework.stereotype.Component;

import java.util.List;

//@Service
@Component
public class Produce2ServiceRedis extends ServiceImpl<ProduceMapper, Produce> implements RedisService<Produce> {
    private final String pojo="Produce";
    private final String idName="id";
    //睡眠时间，即更新数据库所需时间，单位ms
    private final long[] sleepTime = {500, 500, 500, 500};

    @Override
    public String getPojo() {
        return pojo;
    }

    @Override
    public String getIdName() {
        return idName;
    }

    @Override
    public long getSleepTime(int i) {
        return sleepTime[i-1];
    }

    @Override
    public Produce GetById(long id) {
        return getById(id);
    }

    @Override
    public void SaveOrUpdate(Produce object) {
        saveOrUpdate(object);
    }

    @Override
    public void SaveOrUpdateBatch(List<Produce> objects) {
        saveOrUpdateBatch(objects);
    }

    @Override
    public void RemoveById(long id) {
        removeById(id);
    }

    @Override
    public void RemoveByIds(List<Long> ids) {
        removeByIds(ids);
    }
}
